import { defHttp } from '@/utils/http/axios';
import { ErrorMessageMode } from '#/axios';
import {RolePageListGetResultModel} from './model/roleModel'
enum Api {
  GetRoleListByPage = '/role/getRoleListByPage',
  setRoleStatus = '/role/updateRoleStatus',
  UpdateRole = '/role/updateRole',
  DeleteRole = '/role/deleteRole/',
  AddRole = '/role/addRole',
  GetRoleList = '/role/getRoleList'
}
export const getRoleListByPage = (params) =>
  defHttp.get<RolePageListGetResultModel>({ url: Api.GetRoleListByPage, params });
export const setRoleStatus = (roleId: number, status: number) =>
  defHttp.post({ url: Api.setRoleStatus, params: { roleId, status } });
export const UpdateRole = (params, mode: ErrorMessageMode = 'message') => {
  return defHttp.put<any>({ params,url: Api.UpdateRole },
    {
      errorMessageMode: mode,
    },);
};
export const DeleteRole = (params, mode: ErrorMessageMode = 'message') => {
  return defHttp.delete<any>({ url: Api.DeleteRole + params },
    {
      errorMessageMode: mode,
    },);
};
export const AddRole = (params, mode: ErrorMessageMode = 'message') => {
  return defHttp.post<any>({ params,url: Api.AddRole },
    {
      errorMessageMode: mode,
    },);
};
export const getRoleList = ()=>
   defHttp.get({ url: Api.GetRoleList});